package com.note.middleware;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import com.note.common.config.GatewaySecurityAutoConfiguration;
import com.note.common.config.GlobalCorsConfig;
import com.note.common.config.UserContextWebMvcConfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.context.annotation.ComponentScan;

/**
 * 笔记中间件服务启动类
 * 负责处理异步任务、日志记录等功能
 */
@EnableAsync
@EnableKnife4j
@SpringBootApplication
@EnableTransactionManagement
@EnableDiscoveryClient
@EnableFeignClients
@EnableRetry
@Import({
        GatewaySecurityAutoConfiguration.class,
        GlobalCorsConfig.class,
        UserContextWebMvcConfig.class})
@MapperScan("com.note.middleware.mapper")
@EnableMongoRepositories
public class NoteMiddlewareApplication {

    public static void main(String[] args) {
        SpringApplication.run(NoteMiddlewareApplication.class, args);
    }
}